Polymorphism and Constructors
Overview
Polymorphism relies on an inheritance-based model that allows more than one entity to reuse actions and attributes defined for another entity, as described in Inheritance in Data Modeling. It also enables the use of a special control that leverages flexibility and adaptability.
Through polymorphism during execution, this special control automatically considers the whole set of entities reusing actions and attributes.
For example, with Available exams as the base entity from which many other types of exams inherit, this control smartly presents all possibilities:
The image above shows the special control called the Polymorphic launcher.
This control displays an action tree applicable to the entity Available exams (from which entities like Laboratory and Radiology extend).
The final leaf nodes represent entities hosting possible actions (e.g., Blood test, Cytology, Viral tests, Cholesterol and Triglycerides, Estrogens, X-Ray, Intraoral X-Ray, Computed tomography).
To use this control for those final derived entities, you need to define constructors for them.
Constructors
A constructor defines how Bizagi creates new records in an entity, either when a new process starts or upon submitting details in a form.
The Work Portal will display the entity and provide the possibility to launch it if a constructor is defined.
Defining Constructors
To define a constructor for an entity:
- Go into the Expert view and click Entities.
- Locate the entity requiring a new constructor and right-click it to select New constructor. Alternatively, select this option from the Ribbon.
- Use the configuration wizard to define parameters for the new constructor.
1. Define When the Constructor is Applicable
Specify if the constructor applies to new processes or records inputted via forms.
You can select:
-
Using the following process:
Choose a process from the drop-down list or click theicon to define the name of a new process.
-
Filling-out this form:
Choose a form from the drop-down list or click theicon to define a new form using the Forms Designer.
2. Define Who Has Access to This Constructor
Specify which stakeholders can access this action.
Grant access to everyone or select Specific stakeholders to input names (separated by Tab).
3. Define When the Constructor Will Be Available
Determine if the constructor is always visible or assign a Boolean expression (based on data) to decide when it should appear in the Polymorphic launcher control.
To create a new expression, select Expression and click the icon to create one.
Configuring the Polymorphic Launcher
After defining a constructor, you're set.
The Polymorphic launcher in a form does not require additional configuration. It automatically takes the constructor definition for each of the items it presents.
For more information, refer to Polymorphic Launcher.
Considerations
- Each entity can have only one constructor.
If a constructor is already defined, you can edit or delete it by right-clicking the entity and selecting the desired option.